worker_processes 2;
error_log logs/error.log;
pid nginx.pid;
events {
    worker_connections 2048;
}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    client_max_body_size 50m;
    keepalive_timeout 65;
    log_format main '[$time_local] $remote_addr "$http_x_forwarded_for" $remote_port $remote_user '
        '$host $upstream_addr $upstream_status $upstream_response_time $upstream_cache_status '
        '"$request" $status $request_time $body_bytes_sent "$http_referer" "$http_user_agent" ';
                 
    access_log logs/fastdfs.access.log main;

upstream storage {
{% for trackerip in groups.fastdfs_storage %}
    server {{ trackerip }}:{{ fasfng_port }} weight=1 max_fails=2 fail_timeout=10s;
{% endfor %}
}
server {
    listen {{ fasfnghaproxy_port }};
    server_name _;
    location / {
        #err change
        proxy_next_upstream http_502 http_504 http_404 error timeout invalid_header;
        proxy_set_header Host $http_host;
        client_body_buffer_size 10M;
        client_max_body_size 10G;
        proxy_buffers 1024 4k;
        proxy_read_timeout 300;
        proxy_pass http://storage;
        }
    }
}
